package za.ac.lance.singleresponsibilityprinciple.test;

import org.junit.*;
import static org.junit.Assert.*;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import za.ac.lance.config.Config;
import za.ac.lance.singleresponsibilityprinciple.obeys.service.Calc;

/**
 * File Name: SingleResponsibilityPrincipleJUnitTestObey.java
 * Version:
 * Description:
 * Package: za.ac.lance.singleresponsibilityprinciple.test
 * Author: Lance
 * Date: Feb 26, 2012
 */
public class SingleResponsibilityPrincipleJUnitTestObey
{

    private static ApplicationContext context;
    private static Calc calc;

    public SingleResponsibilityPrincipleJUnitTestObey()
    {
    }

    @BeforeClass
    public static void setUpClass() throws Exception
    {
        context = new AnnotationConfigApplicationContext(Config.class);
        calc = (Calc) context.getBean("calculatorService");
    }

    @AfterClass
    public static void tearDownClass() throws Exception
    {
    }

    @Before
    public void setUp()
    {
    }

    @After
    public void tearDown()
    {
    }

    @Test
    public void SingleResponsibilityPrincipleTest()
    {
        assertEquals(2001, calc.Addition(1, 2));
        assertEquals(-999, calc.Subtraction(1, 1000));
    }
}